<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <button class="btn1">赞(0)</button>
    <button class="btn2">赞(0)</button>
    <button class="btn3">赞(0)</button>
    <button class="btn4">赞(0)</button>
    <script>
        // var btn1 = document.querySelector('.btn1')
        // var btn2 = document.querySelector('.btn2')
        // var btn3 = document.querySelector('.btn3')
        // var btn4 = document.querySelector('.btn4')
        var btns = document.querySelectorAll('button')



        function fn() {
            var i = 1;
            return function () {
                this.innerHTML = ` 赞(<span>${i++}</span>)`;
            }
        }
        for (var i = 0; i < btns.length; i++) {
            btns[i].onclick = fn();
        }

    </script>
</body>

</html>